$(document).on('click', '.btn', function () {
    // debugger;
    const username = $('#username').val();
    const password = $('#password').val();
    if (username === "" || password === "") {
        alert("用户名或密码不能为空!!");
    }
    $.ajax({
        type: 'POST',
        url: admin + login,
        data: {
            username: username,
            password: password
        },
        dataType: 'json',
        async: true,
        xhrFields: {withCredentials: true},
        success: function (result) {
            if ((result.result == null || result.result === undefined) && result.description !== "操作成功") {
                alert(result.description);
            } else {
                window.location.href = "login.html";
            }
        }
    });
});